#include "pch.h"
#include <iostream>
#include <vector>

using namespace std;

class Solution {
public:
	int removeDuplicates(vector<int>& nums) {
		int len = nums.size();
		if (!len)return 0;
		int i = 0;
		for (int j = 1;j < len;j++)
		{
			if (nums[j] != nums[i])
			{
				i++;
				nums[i] = nums[j];
			}
		}
		return i+1;
	}
};

int main()
{
	vector <int> v = { 0,0,1,1,2,3,3,3,4,4 };
	Solution s;
	int res = s.removeDuplicates(v);
	cout << res << endl;

	return 0;
}